package com.example.demo.config;

import com.example.demo.service.WeatherService;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.tool.method.MethodToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类，用于将核心服务（工具、资源等）注册到 mcp server
 */
@Configuration
public class ToolCallbackProviderRegister {

    /**
     * 将核心服务（工具、资源等）注册到 mcp server
     * @param weatherService mcp server 业务代码
     * @return MethodToolCallbackProvider 实例
     */
    @Bean
    public ToolCallbackProvider weatherTools(WeatherService weatherService){
        return MethodToolCallbackProvider.builder().toolObjects(weatherService).build();
    }
}
